package cn.dhnapplets.controller;

import cn.dhnapplets.entity.DbOrder;
import cn.dhnapplets.entity.Result;
import cn.dhnapplets.service.DeBangService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author 邱文彬
 * @Date 2021/12/2 14:36
 * @Version 1.0
 */


@RestController
@RequestMapping("/manage/debang")
public class DeBangController {


    @Autowired
    private DeBangService deBangService;


    @ApiOperation("查询所有的德邦订单详细,内置分页")
    @RequestMapping(value = "/getDeBangData",method = RequestMethod.GET)
    public Result getAll(@RequestParam("page") long page, @RequestParam("record") long record) {
        List<DbOrder> dbOrderList = deBangService.getAll(page,record);
        if(dbOrderList == null){
            return new Result(0,"操作失败",null);
        }
        return new Result(0,"操作成功",dbOrderList);
    }

    @ApiOperation("根据订单ID查询订单详细")
    @RequestMapping(value = "/getOrderDataById",method = RequestMethod.GET)
    public Result getOrderDataById(@RequestParam("id") String id){
        return  deBangService.getOrderDataById(id);
    }

    @ApiOperation("根据用户手机号查询订单详细")
    @RequestMapping(value = "/getOrderDataByPhone",method = RequestMethod.GET)
    public Result getOrderDataByPhone(@RequestParam("senderMobile") String senderMobile){
        return  deBangService.getOrderDataByPhone(senderMobile);
    }


}
